#include "defeatscene.h"
#include "ui_defeatscene.h"

defeatscene::defeatscene(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::defeatscene)
{
    ui->setupUi(this);


    initeDefeatscene();

    ui->replay->setStyleSheet("color:white");
    ui->quit->setStyleSheet("color:white");

}
defeatscene::~defeatscene()
{
    delete ui;
}

void defeatscene::initeDefeatscene()
{
    setFixedSize(DEFEAT_SCENE_WIDTH,DEFEAT_SCENE_WIDTH);
    setWindowTitle("游戏失败");
    setWindowIcon(QIcon(":/sucai/ball.PNG"));
}

void defeatscene::show_time()
{
    this->show();
}

void defeatscene::paintEvent(QPaintEvent *)
{
    QPainter defeat(this);
    defeat.drawPixmap(0,0,DEFEAT_SCENE_WIDTH,DEFEAT_SCENE_WIDTH,QPixmap(":/sucai/DEFEAT.png"));
}

void defeatscene::on_replay_clicked()
{
    this->close();
    emit replay();
}

void defeatscene::on_quit_clicked()
{
    int ret = QMessageBox::question(this,"请问","确认退出游戏？");
    if(ret == QMessageBox::Yes)
          this->close();

}
